﻿@using Ed.Entity
@using Ed.Web.Helpers
@model  List<Dictionary<string, object>>
@{
    Layout = null; 
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>雪绒花_客户管理首页</title>
    <link href="../../../../Themes/default/home/css/index.css" rel="stylesheet" type="text/css" />
    <link href="/Themes/default/lib/artDialog/css/ui-dialog.css" rel="stylesheet" />
    <script src="~/Themes/default/lib/jquery/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="/Themes/default/lib/artDialog/dist/dialog-plus-min.js"></script>
    <script src="/Themes/default/lib/function.js"></script>
</head>
<body>
    <script type="text/javascript">
//        $(document).ready(function () {
//            //去除加载中
//            if (undefined != top.dialog.list["show_loading"]) {
//                top.dialog.list["show_loading"].close().remove();
//                //showTopMsg("页面加载成功！", "温馨提示", "Success");
//            }
//            var mid = "@ViewBag.MoudleId";
//            switch (mid) {
//                case "1":
//                    show_client();
//                    break;
//                case "2":
//                    show_order();
//                    break;
//                case "3":
//                    show_yuesao();
//                    break;
//                case "4":
//                    show_finance();
//                    break;
//                case "5":
//                    show_settings();
//                    break;
//                default:
//                    break;
//            }


//        });


        $(function () {
            var m;
            $(".main li").hover(function () {
                m = $(this).index();
                $(".main li img").eq(m).animate({ width: "110px", marginTop: "0px" }, 200).animate({ width: "100px", marginTop: "5px" }, 200);
            }, function () {
                m = $(this).index();
                $(".main li img").eq(m).animate({ width: "90px", marginTop: "10px" }, 0);
            });

            var len = $(".main ul li").length;
            //alert(len);
            var wid = 182 * len;
            $(".main ul").css("width", wid + "px");
        });

        $(function () {
            $(".current-nav").mouseenter(function () {
                $(this).fadeOut(100, function () { $(".sidebar").animate({ left: "0" }, 300); });
            });
            $(".sidebar").mouseleave(function () {
                $(this).animate({ left: "-140px" }, 300, function () { $(".current-nav").fadeIn(0); });
            });
            var n;
            $(".sidebar li").hover(function () {
                n = $(this).index();
                $(".sidebar li img").eq(n).animate({ width: "70px", paddingTop: "0px" }, 200).animate({ width: "60px", paddingTop: "5px" }, 200);
            }, function () {
                n = $(this).index();
                $(".sidebar li img").eq(n).animate({ width: "50px", paddingTop: "10px" }, 0);
            });
        });


//        function show_add() {
//            showTopWindow("show_add_client", "/Customer/ClientInfo/Add?actionType=Add", null, 800, 380, function () {
//                var client_form = $(top.window.frames["frm_show_add_client"].document).find("#clientinfo_form");
//                var flag = top.document.getElementById("frm_show_add_client").contentWindow.form_valid();
//                if (!flag) {
//                    return false;
//                }
//                //var data = $(client_form).serializeObject();
//                var data = $(client_form).serialize();
//                //console.log(data);
//                //return;
//                $.ajax({
//                    type: "POST",
//                    cache: false,
//                    url: "/api/ClientInfoApi/AddClientInfo/",
//                    data: data,
//                    dataType: "json",
//                    beforeSend: function () {
//                        //showMsg("添加中，请稍后...");
//                    },
//                    complete: function () {
//                        //d.close().remove();
//                    },
//                    success: function (result) {
//                        //toLowerCase报错
//                        //var status = result.Status.toLowerCase();
//                        var status = result.Status;
//                        if (status == true || status == "true" || status == "True") {
//                            //关闭当前
//                            top.dialog.list["show_add_client"].close().remove();
//                            //打开列表
//                            show_business();

//                        } else {
//                            showMsg("系统异常，客户添加失败！", "Error");
//                        }
//                    },
//                    error: function () {
//                        showMsg("网络连接错误!", "错误提示", "Error");
//                    }
//                });
//                //必须有这个，阻止刷新
//                return false;
//            });
//        }
        function show_add() {
            showTopWindow("show_add_client", "/Customer/ClientInfo/Edit?actionType=Add", null, 800,380, function () {
                var client_form = $(top.window.frames["frm_show_add_client"].document).find("#clientinfo_form");
                var flag = top.document.getElementById("frm_show_add_client").contentWindow.form_valid();
                if (!flag) {
                    return false;
                }
                var number1 = top.window.frames["frm_show_add_client"].document.getElementById("ClientTel1").value;
                //var data = $(client_form).serializeObject();
                var data = $(client_form).serialize();
                //console.log(data);
                //return;
                $.ajax({
                    type: "POST",
                    cache: false,
                    url: "/api/ClientInfoApi/AddClientInfo/",
                    data: data,
                    dataType: "json",
                    beforeSend: function () {
                        //showMsg("添加中，请稍后...");
                    },
                    complete: function () {
                        //d.close().remove();
                    },
                    success: function (result) {
                        //toLowerCase报错
                        //var status = result.Status.toLowerCase();
                        var status = result.Status;
                        if (status == true || status == "true" || status == "True") {
                            //关闭当前
                            top.dialog.list["show_add_client"].close().remove();
                            //打开列表
                            show_business();
                            showTopMsg("客户添加成功！", "温馨提示", "Success");
                        } else {
                            showMsg("系统异常，客户添加失败！", "Error");
                        }
                    },
                    error: function () {
                        showMsg("网络连接错误!", "错误提示", "Error");
                    }
                });
                //必须有这个，阻止刷新
                return false;
            });
        }
        function show_list() {
            showTopContentWindow("show_list", "/Customer/ClientInfo/List", "全部客户信息管理", 1000, 500);
        }
        function show_business() {
            showTopContentWindow("show_list", "/Customer/ClientInfo/Business", '@Html.Raw("【" + @Session[EdKeys.SESSION_USER_NAME] + "】" + "的业务客户")', 1250, 500);
        }
        function show_maintenance() {
            showTopContentWindow("show_list", "/Customer/ClientInfo/Maintenance", '@Html.Raw("【" + @Session[EdKeys.SESSION_USER_NAME] + "】" + "维护客户")', 1000, 500);
        }
        function show_trash() {
            showTopContentWindow("show_list", "/Customer/ClientInfo/Trash", "回收站客户", 1000, 500);
        } 
    </script>
    <!--固定顶部部分 开始-->
    <div class="header clearfix">
        <a href="javascript:void(0);" class="current-nav" style="display: block;"><em class="menu-more-ico">
        </em><span id="g_mod_name">客户管理</span> </a>
        <div class="vh-avator-area">
            <div class="gl-lang-container">
                <div class="account-avator">
                    <div class="account-avator-bg">
                    </div>
                </div>
                <span class="account-name" id="g_username2">@Session[EdKeys.SESSION_USER_NAME]（<b>@Session[EdKeys.SESSION_ROLE_NAME]</b>）<a
                    href="/Account/Login/Logout/">安全退出</a></span>
            </div>
        </div>
    </div>
    <!--固定顶部部分 结束-->
    <!--主页主题部分 开始-->
    <div class="main">
        <div class="main-container">
            <ul>
                @if (Html.LoadModulePowers(@Model, "Customer_add"))
                {
                    <li onclick="show_add();">
                        <img src="~/Themes/default/home/images/client_01.png"><span>新增客户</span></li>
                }
                @if (Html.LoadModulePowers(@Model, "Customer_business"))
                {
                    <li onclick="show_business();">
                        <img src="~/Themes/default/home/images/client_02.png"><span>业务客户</span></li>
                }
                @if (Html.LoadModulePowers(@Model, "Customer_maintenance"))
                {
                    <li onclick="show_maintenance();">
                        <img src="~/Themes/default/home/images/client_03.png"><span>维护客户</span></li>
                }
                @if (Html.LoadModulePowers(@Model, "Customer_list"))
                {
                    <li onclick="show_list();">
                        <img src="~/Themes/default/home/images/client_04.png"><span>全部客户</span></li>
                }
                @if (Html.LoadModulePowers(@Model, "Customer_trash"))
                {
                    <li onclick="show_trash();">
                        <img src="~/Themes/default/home/images/client_05.png"><span>回收站客户</span></li>
                }
                <div style="clear: both;">
                </div>
            </ul>
        </div>
    </div>
    <!--主页主题部分 结束-->
    <!--侧栏导航-->
    <ul class="sidebar">
        <li><a href="/">
            <img src="~/Themes/default/home/images/btn_06.png"><span>主页</span></a></li>
        @*  @if (Html.LoadModulePowers(@Model, "Customer"))
         {
             <li><a href="/Home/Main/Customer/"><img src="~/Themes/default/home/images/home_btn_03.png"><span>客户管理</span></a></li>
         }*@
        @if (Html.LoadModulePowers(@Model, "Order_add"))
                {
            <li><a href="/Order/Order/OrderAdd/">
                <img src="~/Themes/default/home/images/order_01.png"><span>新增订单</span></a></li>
                }
        @if (Html.LoadModulePowers(@Model, "Order"))
                {
            <li><a href="/Home/Main/Order/">
                <img src="~/Themes/default/home/images/home_btn_05.png"><span>订单管理</span></a></li> 
                    }
        @if (Html.LoadModulePowers(@Model, "Yuangong"))
                {
            <li><a href="/Home/Main/Yuangong/">
                <img src="~/Themes/default/home/images/home_btn_07.png"><span>员工管理</span></a></li> 
                    }
        @if (Html.LoadModulePowers(@Model, "Finance"))
                    {
            <li><a href="/Home/Main/Finance/">
                <img src="~/Themes/default/home/images/home_btn_09.png"><span>财务信息</span></a></li> 
                        }
        @if (Html.LoadModulePowers(@Model, "Settings"))
                        {
            <li><a href="/Home/Main/Seting/">
                <img src="~/Themes/default/home/images/home_btn_11.png"><span>系统设置</span></a></li>
                            }
    </ul>
</body>
</html>
